<template>
	<view style="background: url(https://cdn.yowswl.com/image/admin/2024/02/27/18bb0be5d423434380dc4923e2bbb2eby0vhi06ees.png) no-repeat;height:420rpx;" :style="{backgroundSize:`100% 100%`}">
		<navbar title="商品详情" bgColor="transparent" color="#000" leftIconColor="#000" :back="true"></navbar>
		<view style="padding: 20rpx;">
			<view style="display: flex;">
				<image :src="product.cover" mode="" style="width: 120rpx;height: 120rpx;border-radius: 20rpx;"></image>
				<view style="margin-left: 20rpx;width: 80%;">
					<view style="color: #333;font-size: 26rpx;font-weight:600;">{{product.title}}</view>
					<view style="color: #999;font-size: 24rpx;margin-top: 20rpx;">同步时间: {{product.changeTime}}</view>
				</view>
			</view>
			<view style="padding: 20rpx 0;">
				<u-tabs :list="navList" @click="getNavId" lineColor='#007DF7' :activeStyle="{color:'#007DF7'}"></u-tabs>
			</view>
		</view>
		<view style="background-color: #fff;padding:20rpx;">
			<view style="display: flex;align-items: center;justify-content: space-between;">
				<view style="display: flex;align-items: center;color: #999;font-size: 24rpx;justify-content: space-between;width: 30%;">
					<view class="">支付金额</view>
					<view class="">支付时间</view>
				</view>
				<view style="display: flex;align-items: center;color: #999;font-size: 24rpx;justify-content: space-between;width: 30%;">
					<view class="">状态</view>
					<view class="">BD信息</view>
				</view>
			</view>
			<view v-for="(item,index) in list" :key="index" style="display: flex;justify-content: space-between;align-items: center;margin-top: 20rpx;">
				<view style="display: flex;align-items: center;color: #999;font-size: 24rpx;justify-content: space-between;width: 49%;">
					<view style="color: #ff3f3f;font-size: 28rpx;font-weight: 600;">{{item.totalPayAmount}}</view>
					<view style="color: #333;font-size: 24rpx;">{{item.paySuccessTime}}</view>
				</view>
				<view style="display: flex;align-items: center;color: #999;font-size: 24rpx;justify-content: space-between;width: 32%;">
					<view :style="{color:item.flowPoint=='PAY_SUCC'?'#4DAAFF':item.flowPoint=='REFUND'?'#FF3F3F':item.flowPoint=='SETTLE'?'#47C74E':item.flowPoint=='CONFIRM'?'#FFA842':'',backgroundColor:item.flowPoint=='PAY_SUCC'?'#E7F3FF':item.flowPoint=='REFUND'?'#FFECEC':item.flowPoint=='SETTLE'?'#E0FAE1':item.flowPoint=='CONFIRM'?'#FFF2E3':''}" style="padding:6rpx 10rpx;border-radius: 10rpx;font-size: 20rpx;">{{item.flowPoint=='PAY_SUCC'?'已支付':item.flowPoint=='REFUND'?'已退款':item.flowPoint=='SETTLE'?'已结算':item.flowPoint=='CONFIRM'?'确认收货':''}}</view>
					<view style="display: flex;align-items: center;">
						<image :src="item.avatar" mode="" style="width: 40rpx;height: 40rpx;border-radius: 50%;"></image>
						<view style="font-size: 24rpx;color: #333;margin-left: 10rpx;">{{item.nickname}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getproductDet,
		getProductOrderlist
	} from '@/api/shopAuth.js'
	import navbar from "@/components/baseNavbar.vue"
	export default{
		components:{
			navbar
		},
		data(){
			return{
				id:'',
				product:{},
				navList:[
					{
						name:'全部',
						value:''
					},{
						name:'已支付',
						value:'PAY_SUCC'
					},{
						name:'已退款',
						value:'REFUND'
					},{
						name:'确认收货',
						value:'CONFIRM'
					},{
						name:'已结算',
						value:' SETTLE'
					}
				],
				list:[],
				params:{
					page:1,
					limit:20,
					productId:'',
					flowPoint:'',
					load:true
				}
			}
		},
		onLoad(option) {
			if(option.id){
				this.id = option.id
				this.params.productId = option.id
				getproductDet({productId:this.id,productId:this.id}).then(res=>{
					console.log('1111111',res);
					this.product = res.data
				})
				this.resetList()
			}
		},
		methods:{
			getNavId(e){
				console.log('11',e);
				this.params.flowPoint = e.value
				this.resetList()
			},
			resetList() {
				this.params.page = 1
				this.list = []
				this.getList()
			},
			getList() {
				if (!this.params.load) {
					return;
				}
				this.params.load = false;
				console.log('列表，参数', this.params);
				getProductOrderlist(this.params).then(res => {
					console.log('111',res);
					this.params.page++
					this.list = this.list.concat(res.data.list)
					this.params.load = true
				})
			},
		}
	}
</script>

<style>
	page{
		background-color: #f5f5f5;
		height: 100%;
	}
</style>